import { IManagement } from "@/api";
import {
  Descriptions,
  DescriptionsItemProps,
  Modal,
  ModalProps,
} from "@/components";
import { getLeftItems, getRightItems } from "./helper";
import { Row } from "antd";
import { useAsync } from "@/hooks";
import { getManagementDetail } from "../../service";

interface CheckModal extends ModalProps {
  data?: IManagement.ResManagementItem;
}

export const CheckModal = ({ data, ...restProps }: CheckModal) => {
  const { data: detailData } = useAsync({
    service: getManagementDetail,
    defaultParams: { id: data.id },
    initialData: {}
  });
  return (
    <Modal title="任务详情" width={800} {...restProps} footer={null}>
      <Row wrap={false}>
        <Descriptions
          column={1}
          items={getLeftItems(detailData as IManagement.ResManagementItemCheck)}
        />
        <Descriptions
          column={1}
          items={getRightItems(detailData as IManagement.ResManagementItemCheck)}
        />
      </Row>
    </Modal>
  );
};
